package com.example.star_wars_obiwan;

import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;

public class MainActivity extends Activity {
	@Override
	public void onBackPressed() {
		int resultCode = RESULT_OK;
		Intent data = new Intent().putExtra("im", getString(R.string.im));
		setResult(resultCode, data);

		super.onBackPressed();
	}
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		findViewById(R.id.ready).setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Log.i("tag_MainActivity", "?>>:ready obiwan");
				Toast.makeText(v.getContext(), "?>>:ready obiwan", Toast.LENGTH_LONG).show();

				IntentFilter IntentFilter = new IntentFilter("help");
				registerReceiver(new IMHelper(), IntentFilter);
			}
		});

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

}
